$(document).ready(function() {
	
	$("#new_category_button").click(function(){
		if ($('#id_name').val() == "") {
			$('#id_name').focus();
			alert("Por favor, preencha o campo Nome.");
		} else {
			$('#category_form').submit();
		}
	});

	$("#new_collection_button").click(function(){
		if ($('#id_name').val() == "") {
			$('#id_name').focus();
			alert("Por favor, preencha o campo Nome.");
		} else if ($('#id_cover').val() == "") {
			$('#id_cover').focus();
			alert("Por favor, preencha o campo Capa.");
		} else {
			$('#collection_form').submit();
		}
	});
	
	$("#new_uidp_button").click(function(){
		if ($('#id_name').val() == "") {
			$('#id_name').focus();
			alert("Por favor, preencha o campo Nome.");
		} else {
			$('#uidp_form').submit();
		}
	});
	
	$("#new_solution_button").click(function(){
		if ($('#id_solution').val() == "") {
			$('#id_solution').focus();
			alert("Por favor, preencha o campo Solution.");
		} else {
			$('#solution_form').submit();
		}
	});
	
	$("#new_rel_button").click(function(){
		$('#rel_form').submit();
	});

	$("#show_image_form").click(function() {
		$('#image_example_form').show();
		$('#implementation_example_form').hide();
		$(this).addClass("selected");
		$("#show_implementation_form").removeClass("selected");
	});

	$("#show_implementation_form").click(function() {
		$('#implementation_example_form').show();
		$('#image_example_form').hide();
		$(this).addClass("selected");
		$("#show_image_form").removeClass("selected");
	});
	
	$("#new_implementation_example_button").click(function(){
		$('#implementation_example_form').submit();
	});

	$("#new_image_example_button").click(function(){
		$('#image_example_form').submit();
	});
	
});
